home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 112 / EnigmaAmiga112CD.iso / dalla rivista / awnpipe / awnp / awnp-docs / sexample.doc < prev    next >
Text File  |  2000-05-18  |  3KB  |  86 lines

  1. HINT: Drag select the text then use right Amiga C to copy the examples out of these docs. This helps avoid typos.
  2. ---
  3.  
  4. The simplest use of awnpipe is as an ordinary pipe. That means put data into one end of a pipe and read it out the other.
  5.  
  6. In a shell type 'echo >awnpipe:mypipe hello'
  7. Now type 'type awnpipe:mypipe'
  8.  
  9. The word hello went into the pipe from the echo command, and came out with the type command.
  10.  
  11. 'mypipe' was the name of the pipe. More than one pipe can exist at the same time.
  12.  
  13. In a shell type 'echo >awnpipe:mypipe1 hello'
  14. In a shell type 'echo >awnpipe:mypipe2 goodbye'
  15. In a shell type 'type awnpipe:mypipe1'
  16. In a shell type 'type awnpipe:mypipe2'
  17.  
  18. Two pipes each with a different name.
  19.  
  20. ---
  21.  
  22. Make sure you have two different shells available.
  23.  
  24. In the first shell type 'type awnpipe:mypipe'
  25. In the second shell type 'echo >awnpipe:mypipe hello'
  26.  
  27. You opened the read end of the pipe first. The type command waited until data was available from the pipe THEN returned.
  28.  
  29. A word of caution. Don't try to read from both ends of the pipe at the same time. If you 'type awnpipe:mypipe1' in two separate shells both will hang waiting for data to come from the pipe. AWNPipe notices this and cancels both reads to break the deadlock, this causes both type commands to end without typing any data.
  30.  
  31. ---
  32.  
  33. To use AWNPipe for other functions you add '/' followed by some parameters to the pipe name.'/h' will cause the pipe to translate a few special characters to there HTML equivalents. Note that the '/h' is only used when writing to the pipe.
  34.  
  35. In a shell type 'echo >awnpipe:mypipe/h "& > <"'
  36. In a shell type 'type awnpipe:mypipe'
  37.  
  38. The data is modified as it pass through the pipe.
  39.  
  40. See the advanced examples for more types of data conversion.
  41.  
  42. ---
  43. It is possible to have a pipe automatically connect it self to a file. In these cases you only open the pipe on one end, the other end is automatically connected to a file.
  44.  
  45. '/rFILENAME' reads the contents of FILENAME and places it in the pipe.
  46.  
  47. Create a file 'ram:test' containing some text including the characters '<>&'.
  48.  
  49. Now try this in a shell.
  50.  
  51. type AWNPipe:test/h/rram:test
  52.  
  53. (YES there are two colons ':' in the pipename. Strange but don't let it bug you.)
  54.  
  55. The data from ram:test is read through a modifying pipe.
  56.  
  57. ---
  58.  
  59. '/wFILENAME' writes the output of the pipe to FILENAME.
  60.  
  61. In a shell type 'echo >awnpipe:mypipe/h/wram:AWNPtest "& > <"'
  62.  
  63. Take a look at the file ram:AWNPtest (with your favorite text editor).
  64.  
  65. ---
  66.  
  67. '/u' reverses the translation done by '/h' and '/rFILENAME' reads data into a
  68. pipe.
  69.  
  70. In a shell type 'type awnpipe:mypipe/u/rram:AWNPtest'
  71.  
  72. The contents of the file are read and translated.
  73.  
  74. ---
  75.  
  76. It is possible to have a pipe automatically connect it self to the clipboard.
  77.  
  78. In a shell type 'echo >awnpipe:mypipe/c hello'
  79.  
  80. The word hello was placed into the clipboard. Use your text editor to check it out. Then put different text into the clipboard using your text editor.
  81.  
  82. In a shell type 'type awnpipe:mypipe/v'
  83.  
  84.  The contents of the clipboard are typed out.
  85.  
  86.